package com.softserve.academy.food.model;

import com.softserve.academy.food.entity.eOrder;

public class mOrder 
{
	private int id;
	private mDish dish;

	public mOrder()
	{
	}
	
	public mOrder( eOrder order )
	{
		id = order.getId();
		dish = new mDish( order.getDish() );
	}

	public int getId() 
	{
		return id;
	}

	public void setId( int id ) 
	{
		this.id = id;
	}


	public mDish getDish() 
	{
		return dish;
	}

	public void setDish( mDish dish ) 
	{
		this.dish = dish;
	}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + ((dish == null) ? 0 : dish.hashCode());
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals( Object obj ) 
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof mOrder))
			return false;
		mOrder other = (mOrder) obj;
		if (dish == null) 
		{
			if (other.dish != null)
				return false;
		} 
		else if (!dish.equals(other.dish))
			return false;
		if (id != other.id)
			return false;
		return true;
	}


	@Override
	public String toString() 
	{
		return "mOrder [id=" + id + ", dish=" + dish + "]";
	}



}
